package plantshop.view;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.util.Map;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.MouseInputListener;
import javax.swing.plaf.FontUIResource;

import plantshop.controller.moves.Move;
import plantshop.controller.moves.MoveQueue;
import plantshop.model.Creature;
import plantshop.model.Customer;
import plantshop.model.Display;
import plantshop.model.Game;
import plantshop.model.Opponent;
import plantshop.model.Player;
import plantshop.model.Store;
import plantshop.model.plants.Aster;
import plantshop.model.plants.BurningBush;
import plantshop.model.plants.CommonMilkweed;
import plantshop.model.plants.EasternRedCedar;
import plantshop.model.plants.EnglishIvy;
import plantshop.model.plants.JapaneseBarberry;
import plantshop.model.plants.NorwayMaple;
import plantshop.model.plants.Plant;
import plantshop.model.plants.SweetPepperbush;
import plantshop.model.plants.WhiteOak;
import plantshop.tests.TestNative;
import plantshop.view.listeners.StoreMouseListener;
import plantshop.view.listeners.TutorialMouseListener;


public class View extends JPanel{
	private static final long serialVersionUID = -926204582519090281L;
	
	public final static Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	public final static int frameWidth = screenSize.width;
   	public final static int frameHeight = screenSize.height;
   	public final static double xscale = frameWidth/1600.0;
   	public final static double yscale = frameHeight/900.0;
   	
   	final static int maxStoreRating = 3000;
   	
   	private final int TICKS_PER_ANIMATION_FRAME = 10;
   	
   	public JFrame frame;
	
	private Map<String, BufferedImage> images;
	private Map<String, BufferedImage[]> animations;
	private Player p;
	private Game game;
	private ViewState viewState;
	private boolean tutorial;
	
	private MoveQueue nextMoves;
	
	private int intsructionsX = (int)(50*xscale);
	private int intsructionsY = (int)(500*yscale);
	private int menuX = (int)(200*xscale);
	private int menuY = (int)(100*yscale);
	
	private int TrashX=(int)(55*xscale);
	private int TrashY= (int)(766*yscale);
	
	private int takeOverAnimationCounter = 0;
	private int animationTicks = 0;
	
	int fontSize;
	
	private TutorialMouseListener tutorialListen;
	
	public View(Game game, Player p, Map<String, BufferedImage> images, JFrame frame, boolean tutorial, Map<String, BufferedImage[]> animations, boolean saved){
		this.p = p;
		this.game = game;
		this.tutorial = tutorial;
		this.fontSize = 20;
		nextMoves = new MoveQueue();
		
		this.images = images;
		this.animations = animations;
		this.frame = frame;
		frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(screenSize);
        frame.setTitle("Plant Tycoon");
        
        StoreMouseListener.setView(this);
        
        if(!tutorial || saved){
        	viewState = ViewState.STORE;
        	MouseInputListener storeListen = new StoreMouseListener();
        	addMouseListener(storeListen);
        	addMouseMotionListener(storeListen);
        }
        else{
        	viewState = ViewState.TUTORIAL;
        	tutorialListen = new TutorialMouseListener(this, game);
        	addMouseListener(tutorialListen);
        	addMouseMotionListener(tutorialListen);
        }
	}

	public Map<String,BufferedImage> getImages(){
		return images;
	}
	
	@Override
	public void paint(Graphics g){
		if(viewState == ViewState.STORE)
		{
			drawStore(g);
			drawCustomers(g);
			drawCreatures(g);
			drawOpponents(g);
			drawScore(g, game.getStore().getMoney(),(int)(frameWidth-(250*xscale)), (int)(frameHeight-(180*yscale)));
			drawTime(g, (int)(frameWidth-(250*xscale)), (int)(50*yscale));
			drawSave(g);
			drawRatingBar(g, (int)(frameWidth-(250*xscale)), (int)(frameHeight-(140*yscale)), 1, game.getStoreAttractiveness());
		}
		else if(viewState == ViewState.SEEDMENU)
		{
			drawStore(g);
			drawCustomers(g);
			drawCreatures(g);
			drawSeedMenu(g);
			drawScore(g, game.getStore().getMoney(),(int)(frameWidth-(250*xscale)), (int)(frameHeight-(180*yscale)));
			drawTime(g, (int)(frameWidth-(250*xscale)), (int)(50*yscale));
			drawRatingBar(g, (int)(frameWidth-(250*xscale)), (int)(frameHeight-(140*yscale)), 1, game.getStoreAttractiveness());
			if(!tutorial)
				drawOpponents(g);
			else{
				drawInstructions(g, tutorialListen.getTutorialStage());
			}
		}
		else if(viewState == ViewState.TUTORIAL){
			drawStore(g);
			drawCustomers(g);
			drawCreatures(g);
			drawScore(g, game.getStore().getMoney(),(int)(frameWidth-(250*xscale)), (int)(frameHeight-(180*yscale)));
			drawTime(g, (int)(frameWidth-(250*xscale)), (int)(50*yscale));
			drawRatingBar(g, (int)(frameWidth-(250*xscale)), (int)(frameHeight-(140*yscale)), 1, game.getStoreAttractiveness());
			drawSkip(g);
			drawInstructions(g, tutorialListen.getTutorialStage());
			
			if(tutorialListen.done()){
				new Player(p.getName(), true, images, frame, animations).startGame();
				this.setVisible(false);
			}
		}
	}
	
private void drawInstructions(Graphics g, int tutorialStage) {
	g.setColor(Color.black);
	g.setFont(new FontUIResource(new Font("Arial", 0, 50)));
	Store store = game.getStore();
	if(tutorialStage == 0){
		g.drawImage(images.get("Tutorial0"), 0,(int)(-25*yscale), this);
		g.drawImage(images.get("Instructions Menu"),(int)(intsructionsX),(int)(intsructionsY),this);
		g.drawString("Welcome to your Plant Shop! Let's PLANT some SEEDS!", (int)(intsructionsX+80*xscale), (int)(intsructionsY+60*yscale));
		g.drawString("Click on the empty plot on the left to pick your seeds.", (int)(intsructionsX+80*xscale), (int)(intsructionsY+120*yscale));
		Graphics2D g2 = (Graphics2D)g;
		g2.setColor(Color.YELLOW);
		g2.setStroke(new BasicStroke(5));
		g2.drawRect(store.getBack().get(0).getTopLeft().getX() + (int)(3*xscale), store.getBack().get(0).getTopLeft().getY() - (int)(6*yscale), (int)(105*xscale), (int)(100*yscale));
		}
	else if(tutorialStage == 1){
		g.drawImage(images.get("Tutorial1"), 0,(int)(-25*yscale), this);
		g.drawImage(images.get("Instructions Menu"),(int)(intsructionsX),(int)(intsructionsY),this);
		g.drawString("Click on the Plant to select which plant you want to grow!", (int)(intsructionsX+80*xscale), (int)(intsructionsY+60*yscale));
		Graphics2D g2 = (Graphics2D)g;
		g2.setColor(Color.YELLOW);
		g2.setStroke(new BasicStroke(5));
		g2.drawRect((int)(menuX+93*xscale),(int)(menuY+24*yscale), (int)(160*xscale), (int)(127*yscale));
		}
	else if(tutorialStage == 2){
		g.drawImage(images.get("Tutorial0"), 0,(int)(-25*yscale), this);
		g.drawImage(images.get("Instructions Menu"),(int)(intsructionsX),(int)(intsructionsY),this);
		g.drawString("Once you plant a seed it will grow over time. Click your seeds", (int)(intsructionsX+80*xscale), (int)(intsructionsY+60*yscale));
		g.drawString("here to watch them grow instantly.", (int)(intsructionsX+80*xscale), (int)(intsructionsY+120*yscale));
		Graphics2D g2 = (Graphics2D)g;
		g2.setColor(Color.YELLOW);
		g2.setStroke(new BasicStroke(5));
		g2.drawRect(store.getBack().get(0).getTopLeft().getX() + (int)(3*xscale), store.getBack().get(0).getTopLeft().getY() - (int)(6*yscale), (int)(105*xscale), (int)(100*yscale));
		}
	else if(tutorialStage == 3){
		g.drawImage(images.get("Instructions Menu"),(int)(intsructionsX),(int)(intsructionsY),this);
		g.drawString("Now you can place it in your shop where customers can buy it!", (int)(intsructionsX+80*xscale), (int)(intsructionsY+60*yscale));
		g.drawString("Click and Drag your plant to an open spot in your store.", (int)(intsructionsX+80*xscale), (int)(intsructionsY+120*yscale));
		Graphics2D g2 = (Graphics2D)g;
		g2.setColor(Color.YELLOW);
		g2.setStroke(new BasicStroke(5));
		g2.drawRect(store.getBack().get(0).getTopLeft().getX() + (int)(3*xscale), store.getBack().get(0).getTopLeft().getY() - (int)(6*yscale), (int)(100*xscale), (int)(100*yscale));
		}
	else if(tutorialStage == 4){
		g.drawImage(images.get("Instructions Menu"),(int)(intsructionsX),(int)(intsructionsY),this);
		g.drawString("These customers want plants with certain qualities:", (int)(intsructionsX+80*xscale), (int)(intsructionsY+60*yscale));
		g.setFont(new FontUIResource(new Font("Arial", 0, 25)));
		g.drawString("Provides Shade:", (int)(intsructionsX+80*xscale), (int)(intsructionsY+100*yscale));
		g.drawImage(images.get("Provide Shade"),(int)(intsructionsX+240*xscale), (int)(intsructionsY+75*yscale), this);
		g.drawString("Absorbs Water:", (int)(intsructionsX+325*xscale), (int)(intsructionsY+100*yscale));
		g.drawImage(images.get("Dense Roots"),(int)(intsructionsX+470*xscale), (int)(intsructionsY+75*yscale), this);
		g.drawString("Attracts Butterflies:", (int)(intsructionsX+555*xscale), (int)(intsructionsY+100*yscale));
		g.drawImage(images.get("Butterflies"),(int)(intsructionsX+735*xscale), (int)(intsructionsY+75*yscale), this);
		g.drawString("Attracts Animals:", (int)(intsructionsX+820*xscale), (int)(intsructionsY+100*yscale));
		g.drawImage(images.get("Nourish Wildlife"),(int)(intsructionsX+985*xscale), (int)(intsructionsY+75*yscale), this);
		g.drawString("Engages People:", (int)(intsructionsX+1070*xscale), (int)(intsructionsY+100*yscale));
		g.drawImage(images.get("Engage People"),(int)(intsructionsX+1235*xscale), (int)(intsructionsY+75*yscale), this);
		g.setFont(new FontUIResource(new Font("Arial", 0, 50)));
		g.drawString("Sell a plant to these customers by dragging it to them.", (int)(intsructionsX+80*xscale), (int)(intsructionsY+175*yscale));
		}
	else if(tutorialStage == 5){
		g.drawImage(images.get("Instructions Menu"),(int)(intsructionsX),(int)(intsructionsY),this);
		g.drawString("Now you're ready to run your very own Plant Shop!", (int)(intsructionsX+80*xscale), (int)(intsructionsY+60*yscale));
		g.drawString("Click anywhere to start!", (int)(intsructionsX+80*xscale), (int)(intsructionsY+120*yscale));
		}
	}
	
	public int getmenuX(){
		return menuX;
	}
	
	public int getmenuY(){
		return menuY;
	}
	
	private void drawSeedMenu(Graphics g){
		g.drawImage(images.get("Menu"),menuX,menuY,this);
		g.drawImage(images.get("Menu Japanese Barberry"),menuX+(int)(101*xscale),menuY+(int)(26*yscale),this);		
		g.drawImage(images.get("Menu Common Milkweed"),menuX+(int)(343*xscale),menuY+(int)(26*yscale),this);
		g.drawImage(images.get("Menu English Ivy"),menuX+(int)(585*xscale),menuY+(int)(26*yscale),this);
		g.drawImage(images.get("Menu Eastern Red Cedar"),menuX+(int)(101*xscale),menuY+(int)(177*yscale),this);
		g.drawImage(images.get("Menu Norway Maple"),menuX+(int)(343*xscale),menuY+(int)(177*yscale),this);
		g.drawImage(images.get("Menu Sweet Pepperbush"),menuX+(int)(585*xscale),menuY+(int)(177*yscale),this);
		g.drawImage(images.get("Menu Burning Bush"),menuX+(int)(101*xscale),menuY+(int)(328*yscale),this);
		g.drawImage(images.get("Menu Aster"),menuX+(int)(343*xscale),menuY+(int)(328*yscale),this);
		g.drawImage(images.get("Menu White Oak"),menuX+(int)(585*xscale),menuY+(int)(328*yscale),this);
		
		g.setFont(new Font("TimesRoman", Font.PLAIN, fontSize));
		g.setColor(Color.black);
		g.drawString("Japanese Barberry", menuX+(int)(101*xscale),menuY+(int)(46*yscale));
		g.drawString("Common Milkweed", menuX+(int)(343*xscale),menuY+(int)(46*yscale));
		g.drawString("English Ivy", menuX+(int)(585*xscale),menuY+(int)(46*yscale));
		g.drawString("Eastern Red Cedar", menuX+(int)(101*xscale),menuY+(int)(197*yscale));
		g.drawString("Norway Maple", menuX+(int)(343*xscale),menuY+(int)(197*yscale));
		g.drawString("Sweet Pepperbush", menuX+(int)(585*xscale),menuY+(int)(197*yscale));
		g.drawString("Burning Bush", menuX+(int)(101*xscale),menuY+(int)(348*yscale));
		g.drawString("Aster", menuX+(int)(343*xscale),menuY+(int)(348*yscale));
		g.drawString("White Oak", menuX+(int)(585*xscale),menuY+(int)(348*yscale));
		
		g.setColor(Color.red);
		g.drawString("$10", menuX+(int)(151*xscale),menuY+(int)(146*yscale));
		g.drawString("$10", menuX+(int)(393*xscale),menuY+(int)(146*yscale));
		g.drawString("$10", menuX+(int)(635*xscale),menuY+(int)(146*yscale));
		g.drawString("$15", menuX+(int)(151*xscale),menuY+(int)(297*yscale));
		g.drawString("$15", menuX+(int)(393*xscale),menuY+(int)(297*yscale));
		g.drawString("$15", menuX+(int)(635*xscale),menuY+(int)(297*yscale));
		g.drawString("$20", menuX+(int)(151*xscale),menuY+(int)(448*yscale));
		g.drawString("$20", menuX+(int)(393*xscale),menuY+(int)(448*yscale));
		g.drawString("$20", menuX+(int)(635*xscale),menuY+(int)(448*yscale));
	}
	
	private void drawStore(Graphics g){
		g.drawImage(images.get("Store"), 0, 0, this);
		Store store = game.getStore();
		for(Display disp: store.getBack()){
			for(Plant p: disp){
				drawPlant(g, p);						
			}	
		}
		for(Display disp: store.getFront()){
			for(Plant p: disp)
				drawPlant(g, p);
		}
		if(animationTicks++ % TICKS_PER_ANIMATION_FRAME == 0)
		{
			if(++takeOverAnimationCounter > 4)
				takeOverAnimationCounter = 0;
		}
	}
	
	private void drawScore(Graphics g, int money, int x, int y){
		g.setColor(Color.WHITE);
		g.setFont(new FontUIResource(new Font("Arial", 0, 20)));
		g.drawString("Money:", (int)(x-15*xscale), (int)(y+18*yscale));
		g.drawString("$ "+Integer.toString(money), (int)(x+53*xscale), (int)(y+18*yscale));
	}
	
	private void drawTime(Graphics g, int x, int y){
		g.setColor(Color.white);
		g.setFont(new FontUIResource(new Font("Arial", 0, 50)));
		g.drawString("Time:", x, y-(int)(yscale));
		if(game.getGameTime()/1000<10){
			g.drawImage(images.get(Long.toString(1+game.getGameTime()/1000)), 0, 0, this);
			g.setColor(Color.RED);
		}
		int t = (int)(1+game.getGameTime()/1000);
		String time = Integer.toString(t/60);
		time += ":";
		time += String.format("%02d",t%60);
		g.drawString(time, (int)(x+110*xscale), (int)(y-yscale));
	}
	
	private void drawSkip(Graphics g){
		g.drawImage(images.get("Skip"),(int) (1348*xscale),(int) (18*yscale),this);
	}
	
	private void drawSave(Graphics g){
		g.drawImage(images.get("Save"), (int)(1348*xscale),(int)(75*yscale),this);
	}
	
	private void drawRatingBar(Graphics g, int x, int y, double scale, int rating){
		g.setColor(Color.white);
		g.setFont(new FontUIResource(new Font("Arial", 0, 20)));
		g.drawString("Rating:", (int)(x-15*xscale), (int)(y+21*yscale));
		
		int red = 255;
		int green = 255;
		g.setColor(Color.gray);
		g.fillRect((int)(x+53*xscale), y, (int)(160*scale*xscale), (int)(30*scale*yscale));
		if (rating<maxStoreRating/2)
			green = (int)(255*2*rating/((float)maxStoreRating));
		else
			red = 255 - (int)(255*2*(rating-maxStoreRating/2)/((float)maxStoreRating));
		int ratingLength = 160*rating/maxStoreRating;
		if (ratingLength > 160)
			ratingLength = 160;
		g.setColor(new Color(red, green, 0));
		g.fillRect((int)(x+53*xscale), y, (int)(scale*ratingLength*xscale), (int)(30*scale*yscale));
		if(scale==1)
			g.drawImage(images.get("Rating Bar"), (int)(x+53*xscale) - (int)(10*xscale), y - (int)(15*yscale), this);
	}
	
	private void drawOpponents(Graphics g){
		int count = 1;
		g.setColor(Color.white);
		for(Opponent o: p.getOpponents()){
			g.setFont(new FontUIResource(new Font("Arial", 0, 20)));
			g.drawString(o.getName(), frameWidth-(int)(200*xscale), frameHeight - (int)((75+(count*300)*yscale)));
			drawScore(g, o.getMoney(), frameWidth-(int)(200*xscale), frameHeight-(int)((50+(count*300))*yscale));
			drawRatingBar(g, frameWidth-(int)(200*xscale), frameHeight - (int)(count*300*yscale), 0.5f, o.getRating());
			count++;
		}
	}
	
	public Game getGame() {
		return game;
	}
	public Player getPlayer(){
		return p;
	}

	private void drawCustomers(Graphics g){
		for(Customer c: game.getStore().getCustomers())
		{
			if(c.getType() == 0)
			{
				if(c.getEmotion() == Customer.HAPPY)
					g.drawImage(images.get("Customer 1 Happy"), c.getLoc().getX(), c.getLoc().getY()-100, this);
				else if(c.getEmotion() == Customer.NEUTRAL)
					g.drawImage(images.get("Customer 1 Neutral"), c.getLoc().getX(), c.getLoc().getY()-100, this);
				else
					g.drawImage(images.get("Customer 1 Sad"), c.getLoc().getX(), c.getLoc().getY()-100, this);
					
			}
			else if(c.getType() == 1)
			{
				if(c.getEmotion() == Customer.HAPPY)
					g.drawImage(images.get("Customer 2 Happy"), c.getLoc().getX(), c.getLoc().getY()-100, this);
				else if(c.getEmotion() == Customer.NEUTRAL)
					g.drawImage(images.get("Customer 2 Neutral"), c.getLoc().getX(), c.getLoc().getY()-100, this);
				else
					g.drawImage(images.get("Customer 2 Sad"), c.getLoc().getX(), c.getLoc().getY()-100, this);
					
			}
			else
			{
				if(c.getEmotion() == Customer.HAPPY)
					g.drawImage(images.get("Customer 3 Happy"), c.getLoc().getX(), c.getLoc().getY()-100, this);
				else if(c.getEmotion() == Customer.NEUTRAL)
					g.drawImage(images.get("Customer 3 Neutral"), c.getLoc().getX(), c.getLoc().getY()-100, this);
				else
					g.drawImage(images.get("Customer 3 Sad"), c.getLoc().getX(), c.getLoc().getY()-100, this);
					
			}
			
			if(c.getDesiredPlant().getDominant() == 0 && !c.isLeaving())
			{
				g.drawImage(images.get("Butterflies"), c.getLoc().getX() + 65, c.getLoc().getY()-135, this);
			}
			else if(c.getDesiredPlant().getDominant() == 1 && !c.isLeaving())
			{
				g.drawImage(images.get("Dense Roots"), c.getLoc().getX() + 65, c.getLoc().getY()-135, this);
			}
			else if(c.getDesiredPlant().getDominant() == 2 && !c.isLeaving())
			{
				g.drawImage(images.get("Provide Shade"), c.getLoc().getX() + 65, c.getLoc().getY()-135, this);
			}
			else if(c.getDesiredPlant().getDominant() == 3 && !c.isLeaving())
			{
				g.drawImage(images.get("Nourish Wildlife"), c.getLoc().getX() + 65, c.getLoc().getY()-135, this);
			}
			else if(c.getDesiredPlant().getDominant() == 4 && !c.isLeaving())
			{
				g.drawImage(images.get("Engage People"), c.getLoc().getX() + 65, c.getLoc().getY()-135, this);
			}
			
			if (c.getDisplayMoneySign() > 0)
			{
				g.drawImage(images.get("Money Sign"), c.getLoc().getX() + 65, c.getLoc().getY()-200 + c.getDisplayMoneySign()/2, this);
				c.setDisplayMoneySign(c.getDisplayMoneySign()-1);
			}
		}
	}
	
	private void drawCreatures(Graphics g){
		for(Creature c:game.getStore().getCreatures()){
			if(c.getType()==1){
				g.drawImage(images.get("butterfly"), c.getLocation().getX(), c.getLocation().getY(), this);
			}else if(c.getType()==2)
			{
				g.drawImage(images.get("animal"), c.getLocation().getX(), c.getLocation().getY(), this);
			}
		}
		
	}
	
	private void drawPlant(Graphics g, Plant p){
		if(p.isGrown()){
			if(p instanceof Aster)
				g.drawImage(images.get("Aster"), p.getLoc().getX(), p.getLoc().getY(), this);
			else if(p instanceof BurningBush)
				g.drawImage(images.get("Burning Bush"), p.getLoc().getX(), p.getLoc().getY(), this);
			else if(p instanceof CommonMilkweed)
				g.drawImage(images.get("Common Milkweed"), p.getLoc().getX(), p.getLoc().getY(), this);
			else if(p instanceof EasternRedCedar)
				g.drawImage(images.get("Eastern Red Cedar"), p.getLoc().getX(), p.getLoc().getY(), this);
			else if(p instanceof EnglishIvy)
				g.drawImage(images.get("English Ivy"), p.getLoc().getX(), p.getLoc().getY(), this);
			else if(p instanceof JapaneseBarberry)
				g.drawImage(images.get("Japanese Barberry"), p.getLoc().getX(), p.getLoc().getY(), this);
			else if(p instanceof NorwayMaple)
				g.drawImage(images.get("Norway Maple"), p.getLoc().getX(), p.getLoc().getY(), this);
			else if(p instanceof SweetPepperbush)
				g.drawImage(images.get("Sweet Pepperbush"), p.getLoc().getX(), p.getLoc().getY(), this);
			else if(p instanceof WhiteOak)
				g.drawImage(images.get("White Oak"), p.getLoc().getX(), p.getLoc().getY(), this);
			else if(p instanceof TestNative)
				g.drawImage(images.get("Plant"), p.getLoc().getX(), p.getLoc().getY(), this);
		}
		else{
			g.drawImage(images.get("Seeds"), p.getLoc().getX(), p.getLoc().getY(), this);
			if(p.getTakenOver())
			{
				g.drawImage(animations.get("Invasive Takeover")[takeOverAnimationCounter], p.getLoc().getX()-(int)(50*xscale), p.getLoc().getY()-(int)(25*yscale), this);
			}
		}
	}
	
	public void queueMove(Move m){
		nextMoves.add(m);
	}
	
	public Map<Integer, Move> getNextMoves(){
		Map<Integer, Move> moves = nextMoves.getNext();
		return moves;
	}
	
	public void buyMenu(){
		viewState = ViewState.SEEDMENU;
	}
	
	public void buyMenuEnd(){
		if(!tutorial)
			viewState = ViewState.STORE;
		else
			viewState = ViewState.TUTORIAL;
	}
	
	public int getTrashX() {
		return TrashX;
	}

	public int getTrashY() {
		return TrashY;
	}

	public Map<String, BufferedImage[]> getAnimations()
	{
		return animations;
	}
}
